home *** CD-ROM | disk | FTP | other *** search
- /* calcpixtrans.c
- * AUTHOR: Cy Booker, cy@cheepnis.demon.co.uk
- * LICENSE: FreeWare, Copyright (c) 1995 Cy Booker
- * PURPOSE: generic pixel translation routine
- */
-
- #include "gif2rpc:process_gif.h"
-
- #include <assert.h>
-
- #include "OS:macros.h"
-
-
-
- /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
-
- extern void process_gif_calc_pixtrans(
- const process_gif *p,
- bits *pixtrans) {
- int red, grn, blu;
- os_colour colour;
- int i;
- rgbtupleout err;
- rgbtupleout_fn fn;
- const os_colour *palette;
-
- assert(p);
- assert(pixtrans);
- assert(p->fn);
- assert(p->in_palette.colours);
- assert(p->in_palette.ncolours > 0);
-
- err.palette = p->out_palette; /* structure copy */
-
- palette = p->in_palette.colours;
- fn = p->fn;
- for (i= p->in_palette.ncolours - 1; (i >= 0); i--) {
- colour = palette[i];
- red = (colour >> (1*8)) & 0xff; red |= red << 8;
- grn = (colour >> (2*8)) & 0xff; grn |= grn << 8;
- blu = (colour >> (3*8)) & 0xff; blu |= blu << 8;
- pixtrans[i] = (*fn)(&err, red, grn, blu);
- }
- }
-
-
-
-